<template>
  <div id="main">
    <div id="stage">
      <!-- 蛇 -->
      <div id="snake">
        <!-- 蛇像素点 -->
        <div/>
      </div>
      <div id="food"></div>
    </div>
    <div id="score-pannel">
      <div>SCORE: <span id="score">0</span></div>
      <div>LEVEL: <span id="level">1</span></div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { nextTick } from 'vue'

import { Food } from './moduls/Food';
import { ScorePanel } from './moduls/ScorePanel';
import { Snake } from './moduls/Snake';
import { GameControl } from './moduls/GameControl';

export default defineComponent({
  name: 'App'
});

nextTick(() => {
  const gameControl = new GameControl()
})

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less">
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: 20px;
  font-weight: bold;
}

@bgC: #b7d4a8;

#main {
  margin: 100px auto;
  width: 360px;
  height: 420px;
  border: 10px solid #000000;
  border-radius: 20px;
  background: @bgC;

  #stage {
    position: relative;
    width: 304px;
    height: 304px;
    border: 2px solid #000000;
    margin: 20px auto;

    #snake>div,
    #food {
      position: absolute;
      width: 10px;
      height: 10px;
      background: #000000;
      border: 1px solid @bgC;
    }

    #food {
      left: 40px;
      top: 100px;
      background: #ff0000;
    }
  }

  #score-pannel {
    width: 300px;
    display: flex;
    justify-content: space-between;
    margin: 30px auto;
  }
}
</style>
